<template>
  <div class="wrapper" ref="wrapper">
    <div class="content">
      <slot></slot>
    </div>
  </div>
</template>

<script>
import BetterScroll from 'better-scroll'
export default {
  props:{
    probeType:{
      type:Number,
      default:0
    },
    upload:{
      type:Boolean,
      default:false
    }
  },
data(){
  return{
    scroll:null
  }
},
mounted(){
  this.scroll = new BetterScroll(this.$refs.wrapper,{
    click:true,
    probeType:this.probeType,
    pullUpLoad:this.upload
  })
  this.scroll.on('scroll',(position)=>{
    // console.log(position)
    this.$emit('scrollchange',position)
  })
  this.scroll.on('pullingUp',()=>{
    this.$emit('scrollup')
  })
},
methods:{
  gototop(){
    this.scroll.scrollTo(0,0,500)
  },
  finishPullUp(){
    this.scroll.finishPullUp()
  },
  imgrefresh(){
    console.log("图片加载完成")
    this.scroll.refresh()
  }
}
}
</script>

<style scoped>

</style>